﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Gui
{
    [Serializable()]
    public class RPPedal
    {
        [XmlArray ("Effects")]
        [XmlArrayItem ("Category")]
        public EffectsCategory[] Effects;

        public RPCabinets Cabinets;

        public RPAmplifiers Amplifiers;

        [NonSerialized]
        public int PedalAssign;

        internal Param FindById(OldRPParamID id, CommonPedal @pedal)
        {
            throw new NotImplementedException();
        }
    }

    [Serializable()]
    public class EffectsCategory
    {
        [XmlAttribute]
        public string type;

        [XmlElement("SubCategory")]
        public EffectsSubcategory[] Subcategory;
    }

    [Serializable()]
    public class EffectsSubcategory
    {
        [XmlAttribute]
        public string type;

        [XmlElement("Pedal")]
        public CommonPedal[] Pedal;
    }

    [Serializable()]
    public class Param
    {
        [XmlAttribute]
        public int name;
        [XmlAttribute]
        public string address;
        [XmlAttribute]
        public int value;
        [XmlAttribute]
        public string ParamType;
        [XmlAttribute]
        public string Unit;
        [XmlAttribute]
        public int minValue;
        [XmlAttribute]
        public int maxValue;
        [XmlAttribute]
        public int x;
        [XmlAttribute]
        public int y;
        [XmlAttribute]
        public int width;
        [XmlAttribute]
        public int height;
        [XmlAttribute]
        public int interval;
        [XmlAttribute]
        public string knobType;
    }

    [Serializable()]
    public class Switch
    {
        [XmlAttribute]
        public int x;

        [XmlAttribute]
        public int y;

        [XmlAttribute]
        public int width;

        [XmlAttribute]
        public int height;

        [XmlAttribute]
        public string switchType;

        [XmlAttribute]
        public string switchONImg;

        [XmlAttribute]
        public string switchOFFImg;
    }

    [Serializable()]
    public class CommonPedal
    {
        [XmlAttribute]
        public int id;

        [XmlAttribute]
        public int name;

        [XmlAttribute]
        public string displayName;

        [XmlAttribute]
        public string address;

        [XmlAttribute]
        public string thumb;

        [XmlAttribute]
        public int typeIsVertical;

        [XmlElement ("switch")]
        public Switch switch_;

        [XmlArrayAttribute("Params")]
        public Param[] params_;
    }

    public enum PedalType
    {
        Amp,
        Cab,
        Wah,
        Compressor,
        Distortion,
        EQ,
        Gate,
        Chorus,
        Flanger,
        Phaser, 
        VibRot,
        Tremolo,
        EnvSpec,
        PitchFX,
        Delay,
        Reverb,
        Other
    }

    [Serializable()]
    public class Other
    {
        [XmlAttribute]
        public int id;

        [XmlAttribute]
        public int name;

        [XmlAttribute]
        public string displayName;

        [XmlAttribute]
        public string address;

        [XmlAttribute]
        public string thumb;

        [XmlAttribute]
        public int typeIsVertical;

        [XmlArrayAttribute("Params")]
        public Param[] params_;
    }

    [Serializable]
    public class RPCabinets
    {
        public CabinetCategories Category;
    }

    [Serializable]
    public class CabinetCategories
    {
        [XmlAttribute]
        public string name;

        [XmlArray("Subcategory")]
        public Cabinet[] cabinet;
    }

    [Serializable ]
    public class Cabinet
    {
        [XmlAttribute]
        public int id;

        [XmlAttribute]
        public int name;

        [XmlAttribute]
        public string displayName;

        [XmlAttribute]
        public string thumb;
    }

    [Serializable]
    public class RPAmplifiers
    {
        public AmplifierCategories Category;
    }

    [Serializable]
    public class AmplifierCategories
    {
        [XmlAttribute]
        public string name;

        [XmlArray("Subcategory")]
        public Amplifier[] amp;
    }

    [Serializable]
    public class Amplifier
    {
        [XmlAttribute]
        public int id;

        [XmlAttribute]
        public int name;

        [XmlAttribute]
        public string displayName;

        [XmlAttribute]
        public string address;

        [XmlAttribute]
        public string thumb;
    }
}
